home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Code / About.cls next >
Text File  |  1997-06-14  |  2KB  |  88 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "CAbout"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Option Explicit
  11.  
  12. Public Enum EErrorAbout
  13.     eeBaseAbout = 13660     ' CAbout
  14.     eeAppNotInit            ' Client must be initialized with App object
  15. End Enum
  16.  
  17. ' Private form variable
  18. Private about As New FAbout
  19.  
  20. ' Could be App object, or anything with the same version properties
  21. Public Client As Object
  22. ' Normally the icon of the client application
  23. Public Icon As Picture
  24. ' Miscellaneous properties
  25. Public InfoProg As String
  26. Public Copyright As String
  27. Public Comments As String
  28. Public SecretButton As Integer
  29. Public SecretKey As Integer
  30. Public SecretShift As Integer
  31. Public Animator As IAnimation
  32.  
  33. #If fComponent = 0 Then
  34. Private Sub ErrRaise(e As Long)
  35.     Dim sText As String, sSource As String
  36.     If e > 1000 Then
  37.         sSource = App.EXEName & ".CAbout"
  38.         Select Case e
  39.         Case eeBaseAbout
  40.             BugAssert True
  41.         Case eeAppNotInit
  42.             sText = "Load: Client must be initialized with App object"
  43.         End Select
  44.         Err.Raise COMError(e), sSource, sText
  45.     Else
  46.         ' Raise standard Visual Basic error
  47.         Err.Raise e, sSource
  48.     End If
  49. End Sub
  50. #End If
  51.  
  52. Sub Load()
  53. With about
  54.     ' We need version properties to display on About form
  55.     If Client Is Nothing Then ErrRaise eeAppNotInit
  56.     ' Pass other optional properties through to form
  57.     Set .Client = Client
  58.     Set .ClientIcon = Icon
  59.     .InfoProg = InfoProg
  60.     .Copyright = Copyright
  61.     .Comments = Comments
  62.     .SecretButton = SecretButton
  63.     .SecretKey = SecretKey
  64.     .SecretShift = SecretShift
  65.     .UserInfo(1) = UserInfo(1)
  66.     .UserInfo(2) = UserInfo(2)
  67.     .UserInfo(3) = UserInfo(3)
  68.     ' Show the form
  69.     .Show vbModal
  70. End With
  71. End Sub
  72.  
  73. Property Get UserInfo(i As Integer) As String
  74.     UserInfo = about.UserInfo(i)
  75. End Property
  76.  
  77. Property Let UserInfo(i As Integer, asUserInfoA As String)
  78.     about.UserInfo(i) = asUserInfoA
  79. End Property
  80.  
  81. Private Sub Class_Initialize()
  82.     Debug.Print "Initializing CAbout"
  83. End Sub
  84.  
  85. Private Sub Class_Terminate()
  86.     Debug.Print "Terminating CAbout"
  87. End Sub
  88.